﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IList<Prodma.DataAccess.Models.ViewModels.ContentVm>>" %>

    <div class="listTitleContainer">
        <div class="listTitleCenter-50">#</div>
        <div class="listTitleLeft-400">Ad</div>
        <div class="listTitleCenter-150">Kategori</div>
        <div class="listTitleCenter-150">Dil</div>
        <div class="listTitleCenter-50">ID</div>
    </div>

    <%using (Ajax.BeginForm("GetContentListAJAX", new AjaxOptions() { UpdateTargetId = "contentListDiv", OnBegin = "contentAjaxLoading", OnSuccess = "contentAjaxLoaded" })) %>
    <% { %>
         <div class="listRowContainer">
         <% int totalCount = Convert.ToInt32(ViewData["totalRowCount"]); %>
         <!-- Kategorilere göre ayrıştırma -->
         <% List<int> contentCounts = (List<int>)ViewData["contentCounts"]; %>
         <!-- Listeleme -->
         <% int counter = 1; %>
         <% int seperatorCounter = 0; %>

         <% foreach (int category in (IList<int>)ViewData["categoryList"]) %>
         <% { %>
              <% int same = 0; %>    
              <% foreach (Prodma.DataAccess.Models.ViewModels.ContentVm content in ViewData.Model) %>
              <% { %>
                   <% if (Convert.ToInt32(category) == content.Category.Id) %>
                   <% { %>
                        <% same++; %>
                        <% if (counter % 2 != 0) %>
                        <% { %>
                        <div class="listRow1">
                          <div class="listColumnCenter-50"><%=counter%></div>
                          <div class="listColumnLeft-400">
                            <a href="#" class="listSelectItemBold" onclick='selectItem(1,<%=content.Id %>);'>
                                <%=content.Name%>
                            </a>
                          </div>
                          <div class="listColumnCenter-150"><%=content.Category.Name%></div>
                          <div class="listColumnCenter-150"><%=content.Language.Name%></div>
                          <div class="listColumnCenter-50"><%=content.Id%></div>
                        </div>
                       <% } %>
                       <% else %>
                       <% { %>
                       <div class="listRow2">
                          <div class="listColumnCenter-50"><%=counter%></div>
                          <div class="listColumnLeft-400">
                            <a href="#" class="listSelectItemBold" onclick='selectItem(1,<%=content.Id %>);'>
                                <%=content.Name%>
                            </a>
                          </div>
                          <div class="listColumnCenter-150"><%=content.Category.Name%></div>
                          <div class="listColumnCenter-150"><%=content.Language.Name%></div>
                          <div class="listColumnCenter-50"><%=content.Id%></div>
                       </div>
                       <% } %>
                       <% counter++; %>
                   <% } // if Category == Content.Category.Id %>
              <% } // ForEach Content %>
              <% seperatorCounter++; %>
         <% } // ForEach Category %>
       
        <div class="listFooter">
            <div class="listFooterData">Toplam Kayıt Sayısı : <%=ViewData["totalRowCount"] %></div>
        </div>
       
        <div class="pagerContainer">
           <% Html.RenderPartial("/views/shared/userControls/dataPagerAjax.ascx", new Prodma.DataAccess.Models.UserControlViewModels.DataPagerVm()
           {
               View = "menu",
               TotalRowCount = Convert.ToInt32(ViewData["totalRowCount"]),
               Keys = new List<string>() { "page" },
               Values = new List<string>() { "0" }
           }, new ViewDataDictionary()); %>
        </div>
    </div>

<% } %> 






